using Microsoft.EntityFrameworkCore;
namespace StudentManagement.Models;

public class StudentDbContext : DbContext
{
      public DbSet<Student>Students{get;set;}=null!;
      // OnConfiguring(配置:configuration → configuring)
      // DbContextOption(选择:Option → Options)Builder
      protected override void OnConfiguring(DbContextOptionsBuilder dcob)
      {
            base.OnConfiguring(dcob);
            var conString=$"server=.\\SQLEXPRESS;database=Studetn;uid=sa;pwd=123456;TrustServerCertificate=true";
            dcob.UseSqlServer(conString);
      }
}
// 1.dotnet add package(包裹) Microsoft(微软).Entity(实体)Frame(框架)Work(工作)Core(核心).SqlServer
// 2.dotnet add package Microsoft.EntityFrameWorkCore.Design(设计)
// 3.dotnet tool install --global dotnet-ef
// 4.dotnet build
// 5.dotnet ef migrations(迁移:migration → migrations) add XXX
// 6.dotnet ef database update
